package com.app.service.impl;

import com.app.common.*;
import com.app.mapper.EnterpriseMapper;
import com.app.mapper.JobPublishMapper;
import com.app.model.*;
import com.app.service.*;
import com.app.util.DateUtil;
import com.app.util.StringTool;
import com.app.vo.ExperienceVo;
import com.app.vo.JobPublishVo;
import com.app.vo.JobVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * @Description:岗位实现类
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
public class JobPublishServiceImpl implements JobPublishService {
    @Autowired
    InterviewRecordService interviewRecordService;
    @Autowired
    ComRecruitersService comRecruitersService;
    @Autowired
    JobPublishMapper jobPublishMapper;
    @Autowired
    UserService userService;
    @Autowired
    EnterpriseService enterpriseService;
    @Autowired
    CustomerService customerService;
    @Autowired
    PositionService positionService;
    @Autowired
    LookMeService lookMeService;
    @Autowired
    WorkApplyService workApplyService;

    @Autowired
    private JobIntentionService jobIntentionService;

    @Autowired
    MsgVerifyService msgVerifyService;

    @Autowired
    IndustryService industryService;

    @Override
    public JobPublishModel findJobName(int id) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("job_title").eq("id", id);
        JobPublishModel userList = jobPublishMapper.selectOne(queryWrapper);
        if (userList == null) {
            return null;
        } else {
            return userList;
        }
    }

    @Override
    public JobPublishModel findJobByPost(int jobType) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("rec_id").eq("job_type", jobType);
        JobPublishModel userList = jobPublishMapper.selectOne(queryWrapper);
        if (userList == null) {
            return null;
        } else {
            return userList;
        }
    }
    @Override
    public List<JobPublishModel> findJobByPostList(int jobType) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("job_type", jobType);
        List<JobPublishModel> jobPublishModels = jobPublishMapper.selectList(queryWrapper);
        if (jobPublishModels == null) {
            return null;
        } else {
            return jobPublishModels;
        }
    }

    @Override
    public JobPublishModel findJobByUserAndTitle(int hrId, String title,String minSalary,String maxSalary) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("job_title", title);
        queryWrapper.eq("min_salary", minSalary);
        queryWrapper.eq("max_salary", maxSalary);
        queryWrapper.eq("rec_id",hrId);
        JobPublishModel userList = jobPublishMapper.selectOne(queryWrapper);
        if (userList == null) {
            return null;
        } else {
            return userList;
        }
    }

    @Override
    public JobPublishModel findAllJobById(int id) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("id", id);
        List<JobPublishModel> userList = jobPublishMapper.selectList(queryWrapper);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList.get(0);
        }
    }

    @Override
    public void update(JobPublishModel model) {

        jobPublishMapper.update(model);
    }

    @Override
    public int insertJobs(JobPublishModel jobPublish) {
        return jobPublishMapper.insertJobs(jobPublish);
    }


    @Override
    public Object getInterviewRecord(int id) {
        InterviewRecordModel model = interviewRecordService.getInterviewRecordById(id);
        ComRecruitersModel com = comRecruitersService.getComRecruitersById(model.getRid());
        model.setJobPublish(findAllJobById(model.getPid()));
        com.setUser(userService.getUserByRId(com.getId()));
        EnterpriseModel enterprise = enterpriseService.findModelById(com.getComId());
        com.setEnterprise(enterprise);
        model.setComRecruiters(com);
        return model;
    }

    @Override
    public List<JobPublishModel> getJobPublishListByExOpen(int rid) {
        return jobPublishMapper.getJobPublishListByExOpen(rid);
    }

    @Override
    public Object selectJobsById(int id, UserModel user) throws ParseException {

        CustomerModel cus = null;
        if (user != null) {
            cus = customerService.getCustomerById(user.getCId());
        }
        JobPublishModel job = findAllJobById(id);
        if (job == null) {
            return null;
        }
        ComRecruitersModel com = comRecruitersService.getComRecruitersById(job.getRecId());
        if (com == null) {
            return null;
        }
        if (StringTool.isNotEmpty(com.getLoginTime())) {

            int ss = DateUtil.calLastedTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(com.getLoginTime()));
            if (ss < 86400)//一天
            {
                com.setLoginTimeText("1天内活跃");
            } else if (ss > 86400 && ss < 259200) {
                com.setLoginTimeText("3天内活跃");
            } else if (ss > 259200 && ss < 604800) {
                com.setLoginTimeText("7天内活跃");
            } else if (ss > 604800 && ss < 2592000) {
                com.setLoginTimeText("1月内活跃");
            } else if (ss > 2592000 && ss < 7776000) {
                com.setLoginTimeText("3月内活跃");
            } else if (ss > 7776000 && ss < 15552000) {
                com.setLoginTimeText("半年内活跃");
            } else if (ss > 15552000 && ss < 31536000) {
                com.setLoginTimeText("1年内活跃");
            } else {
                com.setLoginTimeText("1年内未活跃");
            }
        } else {
            com.setLoginTimeText("1年内未活跃");
        }
        List<ExperienceVo> pubWelfareList = new ArrayList<>();
        if (job.getWelfare() != null) {
            String[] welfareStr = job.getWelfare().split(",");
            for (int j = 0; j < welfareStr.length; j++) {
                for (int i = 0; i < WelfareTool.SKILL_VO_LIST.size(); i++) {
                    if (WelfareTool.SKILL_VO_LIST.get(i).getData().equals(welfareStr[j])) {
                        pubWelfareList.add(WelfareTool.SKILL_VO_LIST.get(i));
                    }
                }
            }
        }

        job.setWelfareList(pubWelfareList);
        job.setComRecruiters(com);
        EnterpriseModel enterprise = enterpriseService.findModelById(job.getEnrollId());
        JobPublishModel jobPublish = new JobPublishModel();
        jobPublish.setEnrollId(enterprise.getId());
        jobPublish.setRecruitState(3);
        enterprise.setFairCount(jobPublishMapper.getJobPublishCountByModel(jobPublish));
        if (job.getWelfare() != null && !job.getWelfare().equals("")) {
            String[] str = job.getWelfare().split(",");
            List<String> welfareList = new ArrayList<>();
            for (int j = 0; j < str.length; j++) {
                welfareList.add(str[j]);
            }
            enterprise.setWelfareList(welfareList);
        } else {
            enterprise.setWelfare(null);
        }
        String scaleName = "";
        for (int j = 0; j < ScaleTool.SCALE_VO_LIST.size(); j++) {
            int scale = ScaleTool.SCALE_VO_LIST.get(j).getId();
            if (enterprise.getScaleId() != null) {
                int scaleId = enterprise.getScaleId();
                if (scale == scaleId) {
                    scaleName = ScaleTool.SCALE_VO_LIST.get(j).getData();
                }
            }
        }
        IndustryModel industryModel = industryService.getModelByCode(enterprise.getEnterpriseType());
        if (industryModel != null) {
            enterprise.setEnterpriseTypeText(industryModel.getIndustryName());
        }
        enterprise.setScaleName(scaleName);
        if (com != null) {
            com.setEnterprise(enterprise);
            com.setUser(userService.getUserByRId(com.getId()));
            if (StringTool.isNotEmpty(com.getUser().getMobile())) {
                com.getUser().setMobile(mobileEncrypt(com.getUser().getMobile()));
            }
            job.setComRecruiters(com);
        }
        int expId = job.getExpId();
        int eduId = job.getEduId();
        int jobType = job.getJobType();
        for (int j = 0; j < ExperienceTool.EXPERIENCE_VO_LIST.size(); j++) {
            if (expId == ExperienceTool.EXPERIENCE_VO_LIST.get(j).getId()) {
                job.setExpRequireText(ExperienceTool.EXPERIENCE_VO_LIST.get(j).getData());
            }
        }
        for (int j = 0; j < EducationTool.EDUCATION_VO_LIST.size(); j++) {
            if (eduId == EducationTool.EDUCATION_VO_LIST.get(j).getId()) {
                job.setMinEducationText(EducationTool.EDUCATION_VO_LIST.get(j).getData());
            }
        }

        job.setJobTypeText(positionService.getModelById(jobType).getJobTitle());

        if (cus != null) {
            LookMeModel lookMe = lookMeService.findRidAndPid(job.getId(), 0, 0, cus.getId(), 1, 3);//查询收藏状态
            if (lookMe != null) {
                job.setCollection(1);
            } else {
                job.setCollection(0);

            }
            LookMeModel lookMe2 = lookMeService.findRidAndPid(0, 0, job.getEnrollId(), cus.getId(), 1, 2);//查询关注状态
            if (lookMe2 != null) {
                job.setFollow(1);
            } else {
                job.setFollow(0);

            }
//          ComResumeNumber model = comResumeNumberMapper.getModelById(com.getId(),com.getComId(),id);
            List<WorkApplyModel> modelList = workApplyService.getWorkApplyByCustomer(cus.getId(), id);
            if (modelList == null || modelList.size() == 0) {
                job.setResume(0);
            } else {
                job.setResume(1);
            }
        }
        job.setLookCount(lookMeService.getCountByPid(job.getId()));
        job.setDeliveryCount(workApplyService.getWorkApplyCountByPublishId(job.getId()));

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String time = sdf.format(job.getCrtTime());
        job.setCrtTimeText(time);
        return job;
    }

    // 手机号码前二后二脱敏
    public static String mobileEncrypt(String mobile) {
        if (StringUtils.isEmpty(mobile) || (mobile.length() != 11)) {
            return mobile;
        }
        return mobile.replaceAll("(\\w{2})\\w*(\\w{2})", "$1******$2");
    }

    @Override
    public List<JobPublishModel> getJobPublishListByModel(JobPublishModel jobPublish) {
        return jobPublishMapper.getJobPublishListByModel(jobPublish);
    }

    @Override
    public List<JobPublishModel> findJobPublishListByModel(JobPublishModel jobPublish) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id", "job_title", "job_address", "min_salary", "max_salary", "welfare").eq("enroll_id", jobPublish.getEnrollId()).eq("recruit_state", jobPublish.getRecruitState());
        List<JobPublishModel> userList = jobPublishMapper.selectList(queryWrapper);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList;
        }
    }

    @Override
    public int getJobPublishCountByModel(JobPublishModel jobPublish) {
        return jobPublishMapper.getJobPublishCountByModel(jobPublish);
    }

    @Override
    public int getJobPublishCountByHrId(int recId) {

        return jobPublishMapper.getModelCount(recId);
    }

    @Override
    public int getJobPublishCountByComId(int comId) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("enroll_id",comId);
        return jobPublishMapper.selectCount(queryWrapper);
    }

    @Override
    public void addPublishMsg(ComRecruitersModel com, JobPublishModel jobPublish) {
        List<LookMeModel> lookMeModelList = lookMeService.findLookMeList(2, 2, 0, com.getComId(), 1, 10000).getRecords();
        if (lookMeModelList != null) {
            String mobiles = "";
            for (int i = 0; i < lookMeModelList.size(); i++) {
                List<JobIntentionModel> jobIntentionModelList = jobIntentionService.getJobIntentionByPost(jobPublish.getJobType());
                for (int j = 0; j < jobIntentionModelList.size(); j++) {
                    mobiles += userService.getUserByCustomerId(jobIntentionModelList.get(j).getCustomerId()).getMobile() + ",";
                }
                lookMeModelList.get(i).getCid();
            }
            //各地区发送短信待定
//            msgVerifyService.smsReminder(mobiles, 2);
        }

    }

    @Override
    public int countAll() {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.apply(" TO_DAYS(crt_time) > TO_DAYS('2023-07-14 00:00:00')");
        return jobPublishMapper.selectCount(queryWrapper);
    }
    @Override
    public int passCount() {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.apply(" TO_DAYS(crt_time) > TO_DAYS('2023-07-14 00:00:00')");
        queryWrapper.eq("recruit_state", 3);
        return jobPublishMapper.selectCount(queryWrapper);
    }

    @Override
    public int sumJobNumberAll(String startTime,String endTime,Integer type) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        if(type==1)
        {
            queryWrapper.apply(" TO_DAYS(crt_time) >= TO_DAYS('"+startTime+"')");
            queryWrapper.apply(" TO_DAYS(crt_time) <= TO_DAYS('"+endTime+"')");
        }else{
            queryWrapper.apply(" TO_DAYS(crt_time) > TO_DAYS('2023-07-14 00:00:00')");
        }
        queryWrapper.select("sum(job_number) as sumAll");
        JobPublishModel model = jobPublishMapper.selectOne(queryWrapper);
        if (model != null) {
            return model.getSumAll();
        } else {
            return 0;
        }

    }

    @Override
    public int countWait() {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("recruit_state", 1);
        return jobPublishMapper.selectCount(queryWrapper);
    }

    @Override
    public int getModelCountByTime(String crtTime) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.apply("TO_DAYS(crt_time) = TO_DAYS('" + crtTime + "')");
        return jobPublishMapper.selectCount(queryWrapper);
    }

    @Override
    public JobPublishVo publishListByModel(JobPublishModel model) {

        List<JobPublishModel> modelList = getJobPublishListByModel(model);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

        for (int i = 0; i < modelList.size(); i++) {
            String bir = sdf.format(modelList.get(i).getCrtTime());
            modelList.get(i).setCrtTimeText(bir);
            modelList.get(i).setEnterprise(enterpriseService.findModelById(modelList.get(i).getEnrollId()));
            if (modelList.get(i).getRecruitState() == 1) {
                modelList.get(i).setRecruitStateText("待审核");
            } else if (modelList.get(i).getRecruitState() == 2) {
                modelList.get(i).setRecruitStateText("未过审");
            } else if (modelList.get(i).getRecruitState() == 3) {
                modelList.get(i).setRecruitStateText("开放中");
            } else if (modelList.get(i).getRecruitState() == 4) {
                modelList.get(i).setRecruitStateText("已关闭");
            }

        }
        int count = getJobPublishCountByModel(model);
        JobPublishVo vo = new JobPublishVo();
        vo.setList(modelList);
        vo.setCount(count);
        return vo;
    }

    @Override
    public JobPublishModel publishListById(int id) {
        JobPublishModel job = findAllJobById(id);
        JobVo jobvo = new JobVo();
        jobvo.setCode(1);
        ComRecruitersModel com = comRecruitersService.getComRecruitersById(job.getRecId());
        job.setComRecruiters(com);
        EnterpriseModel enterprise = enterpriseService.findModelById(job.getEnrollId());
        job.setEnterprise(enterprise);
        String scaleName = "";
        String enterpriseName = "";
        for (int j = 0; j < ScaleTool.SCALE_VO_LIST.size(); j++) {
            int scale = ScaleTool.SCALE_VO_LIST.get(j).getId();
            int scaleId = enterprise.getScaleId();
            if (scale == scaleId) {
                scaleName = ScaleTool.SCALE_VO_LIST.get(j).getData();
            }
        }
        IndustryModel industryModel = industryService.getModelByCode(enterprise.getEnterpriseType());
        enterprise.setEnterpriseTypeText(industryModel.getIndustryName());
        enterprise.setScaleName(scaleName);
        if (com != null) {
            com.setEnterprise(enterprise);
            com.setUser(userService.getUserByRId(com.getId()));
            job.setComRecruiters(com);
        }
        int expId = job.getExpId();
        int eduId = job.getEduId();
        int jobType = job.getJobType();
        for (int j = 0; j < ExperienceTool.EXPERIENCE_VO_LIST.size(); j++) {
            if (expId == ExperienceTool.EXPERIENCE_VO_LIST.get(j).getId()) {
                job.setExpRequireText(ExperienceTool.EXPERIENCE_VO_LIST.get(j).getData());
            }
        }
        for (int j = 0; j < EducationTool.EDUCATION_VO_LIST.size(); j++) {
            if (eduId == EducationTool.EDUCATION_VO_LIST.get(j).getId()) {
                job.setMinEducationText(EducationTool.EDUCATION_VO_LIST.get(j).getData());
            }
        }

        job.setJobTypeText(positionService.getModelById(jobType).getJobTitle());

        return job;
    }

    @Override
    public JobPublishVo getJobPublishList(JobPublishModel model) {
        List<JobPublishModel> modelList = getJobPublishListByModel(model);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        for (int i = 0; i < modelList.size(); i++) {
            String bir = sdf.format(modelList.get(i).getCrtTime());
            modelList.get(i).setCrtTimeText(bir);
            PositionModel position = positionService.getModelById(modelList.get(i).getJobType());
            if (position != null) {
                modelList.get(i).setJobTypeText(position.getJobTitle());
            }
            modelList.get(i).setEnterprise(enterpriseService.findModelById(modelList.get(i).getEnrollId()));
        }
        int count = getJobPublishCountByModel(model);
        JobPublishVo vo = new JobPublishVo();
        vo.setCount(count);
        vo.setList(modelList);
        return vo;
    }

    @Override
    public Page<JobPublishModel> getModelByType(JobPublishModel model) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("job_type", model.getJobType());
        Page<JobPublishModel> page = new Page<>();
        page.setCurrent(model.getPage());
        page.setSize(model.getLimit());
        Page<JobPublishModel> EnterpriseModel = jobPublishMapper.selectPage(page, queryWrapper);
        if (EnterpriseModel == null) {
            return null;
        } else {
            return EnterpriseModel;
        }
    }

    @Override
    public int getModelCountByEid(int enrollId) {
        return jobPublishMapper.getModelCountByEid(enrollId);
    }

    @Override
    public List<JobPublishModel> getModelGroupType() {
        return jobPublishMapper.getModelGroupType();
    }

    @Override
    public List<JobPublishModel> getComPublishByComId(String[] comIds) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id", "job_title", "enroll_id").in("enroll_id", comIds);
        List<JobPublishModel> userList = jobPublishMapper.selectList(queryWrapper);
        return userList;
    }

    public List<JobPublishModel> getComPublishById(String[] ids) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id", "job_title", "job_address", "min_salary", "max_salary", "enroll_id").in("id", ids);
        List<JobPublishModel> userList = jobPublishMapper.selectList(queryWrapper);
        return userList;
    }

    @Override
    public Integer getCountByStreetId(Integer streetId) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("street_id", streetId);
        queryWrapper.eq("recruit_type", 1);
        queryWrapper.eq("recruit_state", 3);
        return jobPublishMapper.selectCount(queryWrapper);
    }

    @Override
    public Integer selectActivityThisMonthCount() {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("recruit_state", 3);
        return jobPublishMapper.selectCount(queryWrapper);
    }

    @Override
    public Integer selectRecruitmentCount() {
        return jobPublishMapper.selectCount(null);
    }

    @Override
    public List<JobPublishModel> selectPost() {
        return jobPublishMapper.selectPost();
    }

    @Override
    public List<JobPublishModel> selectAll() {
        List<JobPublishModel> jobPublishModels = jobPublishMapper.selectList(null);
        List<EnterpriseModel> enterpriseModels = enterpriseService.selectAll();
        for (int i = 0; i < jobPublishModels.size(); i++) {
            for (int i1 = 0; i1 < enterpriseModels.size(); i1++) {
                if (jobPublishModels.get(i).getEnrollId().equals(enterpriseModels.get(i1).getId())) {
                    jobPublishModels.get(i).setEnterpriseModels(enterpriseModels.get(i1));
                }
            }
        }
        return jobPublishModels;
    }

    @Override
    public Page<JobPublishModel> postList(Integer page1, Integer limit) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("recruit_state", 3);
        queryWrapper.orderByDesc("id");
        Page<JobPublishModel> page = new Page<>();
        page.setCurrent(page1);
        page.setSize(limit);
        Page<JobPublishModel> EnterpriseModel = jobPublishMapper.selectPage(page, queryWrapper);
        for (int i = 0; i < EnterpriseModel.getRecords().size(); i++) {
            for (int i1 = 0; i1 < EducationTool.EDUCATION_VO_LIST.size(); i1++) {
                if (EnterpriseModel.getRecords().get(i).getEduId() == EducationTool.EDUCATION_VO_LIST.get(i1).getId()) {
                    EnterpriseModel.getRecords().get(i).setEductionText(EducationTool.EDUCATION_VO_LIST.get(i1).getData());
                }
            }
            EnterpriseModel.getRecords().get(i).setComName(enterpriseService.findModelById(EnterpriseModel.getRecords().get(i).getEnrollId()).getBrandName());
        }
        if (EnterpriseModel == null) {
            return null;
        } else {
            return EnterpriseModel;
        }
    }

    @Override
    public Page<JobPublishModel> allPostList(Integer page1, Integer limit) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id");
        Page<JobPublishModel> page = new Page<>();
        page.setCurrent(page1);
        page.setSize(limit);
        Page<JobPublishModel> EnterpriseModel = jobPublishMapper.selectPage(page, queryWrapper);
        for (int i = 0; i < EnterpriseModel.getRecords().size(); i++) {
            for (int i1 = 0; i1 < EducationTool.EDUCATION_VO_LIST.size(); i1++) {
                if (EnterpriseModel.getRecords().get(i).getEduId() == EducationTool.EDUCATION_VO_LIST.get(i1).getId()) {
                    EnterpriseModel.getRecords().get(i).setEductionText(EducationTool.EDUCATION_VO_LIST.get(i1).getData());
                }
            }
            EnterpriseModel.getRecords().get(i).setComName(enterpriseService.findModelById(EnterpriseModel.getRecords().get(i).getEnrollId()).getBrandName());
        }
        if (EnterpriseModel == null) {
            return null;
        } else {
            return EnterpriseModel;
        }
    }
    @Override
    public List<JobPublishModel> supplyAndDemandIndustries() {
        return jobPublishMapper.supplyAndDemandIndustries();
    }
    @Override
    public JobPublishVo getJobPublishCountByPost(List<Integer> integerList, Integer page1, Integer limit) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("job_type", integerList);
        Page<JobPublishModel> page = new Page<>();
        page.setCurrent(page1);
        page.setSize(limit);
        Page<JobPublishModel> jobPublishModelPage = jobPublishMapper.selectPage(page, queryWrapper);
        JobPublishVo vo = new JobPublishVo();
        vo.setList(jobPublishModelPage.getRecords());
        vo.setCount((int) jobPublishModelPage.getTotal());
        return vo;
    }

    @Override
    public int sumJobNumberByEntId(Integer entId) {
        QueryWrapper<JobPublishModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("enroll_id",entId);
        queryWrapper.select("sum(job_number) as sumAll");
        JobPublishModel model = jobPublishMapper.selectOne(queryWrapper);
        if (model != null) {
            return model.getSumAll();
        } else {
            return 0;
        }
    }
}
